//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "tools\fn_getConfigEntry.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_config","_entryName","_entry", "_value"];
DEFAULT_PARAM(_config,0,nil);
DEFAULT_PARAM(_entryName,1,nil);
_value = nil;
if (IS_CONFIG(_config) && IS_STRING(_entryName)) then {
	_entry = _config >> _entryName;
	if (((configName (_config >> _entryName)) == "") && (!((configName _config) in ["CfgVehicles", "CfgWeapons", ""]))) then {
		[inheritsFrom _config, _entryName] call FFUNC(getConfigEntry);
	} else {
		if (isNumber _entry) then {
			_value = getNumber _entry;
		} else {
			if (isText _entry) then {_value = getText _entry};
		};
	};
} else {
	ERROR("Invalid Parameters");
};
TRACE_1("End",_value);
TMFPROFILERSTOP;
_value